<%@page import="cn.cdahua.basic.model.SystemContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	SystemContext.setRealPath(session.getServletContext().getRealPath("/resources"));
%>
<!DOCTYPE html>
<html>
<head>
<jsp:include page="../comm/style.jsp"></jsp:include>
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/resources/uploadify/uploadify.css" />
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/uploadify/jquery.uploadify.min.js"></script>
<style type="text/css">
.update{
	margin-top: 20px;
	margin-right: 40px;
}
</style>

</head>
<body>
	<input type="hidden" id="ctx" value="<%=request.getContextPath()%>">
	<div class="update">
		<form method="post" class="form-horizontal">
			<input type="hidden" id="icon" name="icon">
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>
				<div class="col-sm-10">
					<input name="email" type="email" class="form-control"
						value="${user.email }">
				</div>
			</div>
			<div class="form-group">
				<label for="inputText3" class="col-sm-2 control-label">姓名</label>
				<div class="col-sm-10">
					<input name="username" type="text" class="form-control"
						value="${user.username }">
				</div>
			</div>
			<div class="form-group">
				<label for="inputText3" class="col-sm-2 control-label">昵称</label>
				<div class="col-sm-10">
					<input name="nickname" type="text" class="form-control"
						value="${user.nickname }">
				</div>
			</div>
			<div class="form-group">
				<label for="inputText3" class="col-sm-2 control-label">头像</label>
				<div class="col-sm-10">
					<input type="file" name="iconF" id="iconF" />
					<p id="result" style="visibility: hidden;">图片上传成功</p>
					<input type="button" class="btn" id="uploadFile" value="上传图片" />
				</div>
			</div>
			<c:if test="${user.id != loginUser.id }">
				<div class="form-group">
					<label for="inputText3" class="col-sm-2 control-label">角色</label>
					<div class="col-sm-10">
						<div class="checkbox">
							<label> <input type="checkbox" name="rid" value="1">
								普通管理员
							</label> <label> <input type="checkbox" name="rid" value="2">
								超级管理员
							</label> <label> <input type="checkbox" name="rid" value="3">
								学生
							</label> <label> <input type="checkbox" name="rid" value="4">
								教师
							</label>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label for="inputText3" class="col-sm-2 control-label">部门</label>
					<div class="col-sm-10">
						<div class="checkbox">
							<label> <input type="checkbox" name="gid" value="1">
								新媒体
							</label> <label> <input type="checkbox" name="gid" value="2">
								广播台
							</label>
						</div>
					</div>
				</div>
			</c:if>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-default">修改</button>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript">
		$(function() {
			$('#iconF').uploadify({
				'swf' : $('#ctx').val() + '/resources/uploadify/uploadify.swf',
				'uploader' : $('#ctx').val() + '/system/upload',
				'buttonText' : '点击选择头像',
				'fileTypeExts' : "*.jpg;*.gif;*.png;",
				'auto' : false,
				'fileObjName' : 'iconF',
				'onUploadSuccess' : function(file, data, response) {
					$('#icon').val(data)
					$('#result').css("visibility", "visible");
				}
			});
			$("#uploadFile").click(function() {
				$("#iconF").uploadify("upload", "*");
			})
		});
	</script>
</body>
</html>